//
//  LocalDataManager.h
//  OrangeNote
//
//  Created by 刘崇龙 on 16/1/23.
//  Copyright © 2016年 崇龙. All rights reserved.
//

#import <Foundation/Foundation.h>
@class NotebookModel;
@class NoteModel;

typedef void(^UpdateUI)();
@interface LocalDataManager : NSObject

+ (instancetype)sharedDataBase;

- (void)openDB;

// 新建Notebook
- (void)insertNotebookWithNotebook:(NotebookModel *)notebook;
@property(nonatomic ,copy)UpdateUI updateUI;

// 删除Notebook
- (void)deleteNotebookWithNotebookID:(NSString *)ID;

// 根据ID改Notebook
- (void)updateNotebookWithNotebookID:(NSString *)ID andNotebook:(NotebookModel *)notebook;

// 根据ID查询Notebook
- (NotebookModel *)selectNotebookWithNotebookID:(NSString *)ID;

// 查询所有Notebook
- (NSMutableArray *)selectAllNotebook;




// 往数据库插入model
- (void)insertNoteWithModel:(NoteModel *)model;

@property(nonatomic ,copy)UpdateUI updateNoteUI; // 待定

// 根据ID查询笔记
- (NoteModel *)selectNoteWithNoteID:(NSString *)ID;

// 删除笔记
- (void)deleteNoteWithNoteID:(NSString *)ID;

// 更改笔记
- (void)updateNoteWithNoteID:(NSString *)ID andNote:(NoteModel *)note;

// 按最后更新时间降序排列
- (NSMutableArray *)orderAllNoteByDescWithNotebookID:(NSString *)notebookID;

@end
